jQuery(document).ready(function(){
	//chi hien thong tin tren dialog
	jQuery("#myDialog").dialog({
		   bgiframe: true,
		   autoOpen: false,
		   height: 400,
		   width: 500,
		   title:'Thông tin tên miền tiếng việt',
		   modal: true,
		   resizable:false
	});

	//su dung submit form
	jQuery("#submitDialog").dialog({
	   bgiframe: true,
	   autoOpen: false,
		height: 'auto',
       width: 'auto',
	   modal: true,
	   resizable:false,
	   buttons: {
		  'Save': function(){
				jQuery("#form").submit();
				return false;
		  },
		  Cancel: function(){
			jQuery(this).dialog('close');
		  }
	   }
	});
	var flag = false;
	jQuery('.hint').click(function(){
		var str = jQuery(this).attr('datafld');
		var datafld = str.split('-');
		jQuery.ajax({
			type: "GET",
			dataType: "html",
			url: base_url+'ajax/'+datafld[0]+'/'+datafld[1],
			data: "",
			success: function(data){
				jQuery('#submitDialog').html(data);
				jQuery('#submitDialog').dialog('open');
				jQuery('.ui-dialog').addClass('popup');
				jQuery('.ui-dialog-title').html($('#title').text());
				if(flag == false){
					$(".ui-dialog-buttonpane button:first").html('<button class="ui-button-text">Chấp Nhận</button>');
					$(".ui-dialog-buttonpane button:last").html('<button class="ui-button-text">Hủy</button>');
					flag = true;
				}
				$('.ui-dialog-buttonpane button').addClass('ui-icon-btn');

				return false;
			}
		});
	});

});

